Skip to content

Commit edb16c0

Browse files
authored
Lint: fix CSS syntax and some antipatterns (#39685)
1 parent 892eea5 commit edb16c0

File tree

27 files changed

+31
-89
lines changed

27 files changed

+31
-89
lines changed

files/en-us/learn_web_development/core/accessibility/wai-aria_basics/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ footer {
270270
}
271271

272272
nav {
273-
background-color: ff80ff;
273+
background-color: #ff80ff;
274274
display: flex;
275275
gap: 2vw;
276276
@media (width <= 650px) {
@@ -523,7 +523,7 @@ footer {
523523
}
524524

525525
nav {
526-
background-color: ff80ff;
526+
background-color: #ff80ff;
527527
display: flex;
528528
gap: 2vw;
529529
@media (width <= 650px) {

files/en-us/learn_web_development/core/frameworks_libraries/react_todo_list_beginning/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,6 @@ body {
374374
text-align: center;
375375
}
376376
.visually-hidden {
377-
clip: rect(1px 1px 1px 1px);
378377
clip: rect(1px, 1px, 1px, 1px);
379378
height: 1px;
380379
overflow: hidden;

files/en-us/learn_web_development/core/frameworks_libraries/svelte_todo_list_beginning/index.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,6 @@ body {
522522
height: 1px;
523523
width: 1px;
524524
overflow: hidden;
525-
clip: rect(1px 1px 1px 1px);
526525
clip: rect(1px, 1px, 1px, 1px);
527526
white-space: nowrap;
528527
}
@@ -608,7 +607,7 @@ body {
608607
}
609608
.filters {
610609
width: 100%;
611-
margin: unset auto;
610+
margin: unset;
612611
}
613612
/* Todo item styles */
614613
.todo {

files/en-us/learn_web_development/core/frameworks_libraries/vue_styling/index.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ Update your `App.vue` file's `<style>` element so it looks like so:
225225
height: 1px;
226226
width: 1px;
227227
overflow: hidden;
228-
clip: rect(1px 1px 1px 1px);
229228
clip: rect(1px, 1px, 1px, 1px);
230229
clip-path: rect(1px, 1px, 1px, 1px);
231230
white-space: nowrap;
@@ -351,7 +350,6 @@ Next, copy the following CSS into the newly created `<style>` element:
351350
-webkit-font-smoothing: antialiased;
352351
-moz-osx-font-smoothing: grayscale;
353352
font-weight: 400;
354-
font-size: 16px;
355353
font-size: 1rem;
356354
line-height: 1.25;
357355
color: #0b0c0c;
@@ -363,12 +361,10 @@ Next, copy the following CSS into the newly created `<style>` element:
363361
-webkit-font-smoothing: antialiased;
364362
-moz-osx-font-smoothing: grayscale;
365363
font-weight: 400;
366-
font-size: 16px;
367364
font-size: 1rem;
368365
line-height: 1.25;
369366
box-sizing: border-box;
370367
width: 100%;
371-
height: 40px;
372368
height: 2.5rem;
373369
margin-top: 0;
374370
padding: 5px;
@@ -453,7 +449,6 @@ Next, copy the following CSS into the newly created `<style>` element:
453449
label,
454450
input,
455451
.custom-checkbox {
456-
font-size: 19px;
457452
font-size: 1.9rem;
458453
line-height: 1.31579;
459454
}

files/en-us/learn_web_development/extensions/forms/how_to_build_custom_form_controls/example_1/index.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ This is the first example of code that explains [how to build a custom form widg
7171

7272
box-shadow: 0 0.1em 0.2em rgb(0 0 0 / 45%); /* 0 1px 2px */
7373

74-
background: #f0f0f0;
7574
background: linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0);
7675
}
7776

@@ -207,7 +206,6 @@ This is the first example of code that explains [how to build a custom form widg
207206

208207
box-shadow: 0 0.1em 0.2em rgb(0 0 0 / 45%); /* 0 1px 2px */
209208

210-
background: #f0f0f0;
211209
background: linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0);
212210
}
213211

@@ -343,7 +341,6 @@ This is the first example of code that explains [how to build a custom form widg
343341

344342
box-shadow: 0 0.1em 0.2em rgb(0 0 0 / 45%); /* 0 1px 2px */
345343

346-
background: #f0f0f0;
347344
background: linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0);
348345
}
349346

files/en-us/learn_web_development/extensions/forms/how_to_build_custom_form_controls/example_2/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ This is the second example that explain [how to build custom form widgets](/en-U
8989

9090
box-shadow: 0 0.1em 0.2em rgb(0 0 0 / 45%); /* 0 1px 2px */
9191

92-
background: #f0f0f0;
9392
background: linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0);
9493
}
9594

files/en-us/learn_web_development/extensions/forms/how_to_build_custom_form_controls/example_3/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ This is the third example that explain [how to build custom form widgets](/en-US
8989

9090
box-shadow: 0 0.1em 0.2em rgb(0 0 0 / 45%); /* 0 1px 2px */
9191

92-
background: #f0f0f0;
9392
background: linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0);
9493
}
9594

files/en-us/learn_web_development/extensions/forms/how_to_build_custom_form_controls/example_4/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ This is the fourth example that explain [how to build custom form widgets](/en-U
8989

9090
box-shadow: 0 0.1em 0.2em rgb(0 0 0 / 45%); /* 0 1px 2px */
9191

92-
background: #f0f0f0;
9392
background: linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0);
9493
}
9594

files/en-us/learn_web_development/extensions/forms/how_to_build_custom_form_controls/example_5/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ This is the last example that explain [how to build custom form widgets](/en-US/
8989

9090
box-shadow: 0 0.1em 0.2em rgb(0 0 0 / 45%); /* 0 1px 2px */
9191

92-
background: #f0f0f0;
9392
background: linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0);
9493
}
9594

files/en-us/learn_web_development/extensions/forms/how_to_build_custom_form_controls/index.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,6 @@ So now that we have the basic functionality in place, the fun can start. The fol
188188
border-radius: 0.4em;
189189
box-shadow: 0 0.1em 0.2em rgb(0 0 0 / 45%);
190190

191-
/* The first declaration is for browsers that do not support linear gradients. */
192-
background: #f0f0f0;
193191
background: linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0);
194192
}
195193

@@ -331,7 +329,6 @@ So here's the result with our three states ([check out the source code here](/en
331329

332330
box-shadow: 0 0.1em 0.2em rgb(0 0 0 / 45%); /* 0 1px 2px */
333331

334-
background: #f0f0f0;
335332
background: linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0);
336333
}
337334

@@ -453,7 +450,6 @@ So here's the result with our three states ([check out the source code here](/en
453450

454451
box-shadow: 0 0.1em 0.2em rgb(0 0 0 / 45%); /* 0 1px 2px */
455452

456-
background: #f0f0f0;
457453
background: linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0);
458454
}
459455

@@ -575,7 +571,6 @@ So here's the result with our three states ([check out the source code here](/en
575571

576572
box-shadow: 0 0.1em 0.2em rgb(0 0 0 / 45%); /* 0 1px 2px */
577573

578-
background: #f0f0f0;
579574
background: linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0);
580575
}
581576

@@ -835,7 +830,6 @@ Check out the [full source code](/en-US/docs/Learn_web_development/Extensions/Fo
835830

836831
box-shadow: 0 0.1em 0.2em rgb(0 0 0 / 45%); /* 0 1px 2px */
837832

838-
background: #f0f0f0;
839833
background: linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0);
840834
}
841835

@@ -1133,7 +1127,6 @@ Check out the [full source code](/en-US/docs/Learn_web_development/Extensions/Fo
11331127

11341128
box-shadow: 0 0.1em 0.2em rgb(0 0 0 / 45%); /* 0 1px 2px */
11351129

1136-
background: #f0f0f0;
11371130
background: linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0);
11381131
}
11391132

@@ -1463,7 +1456,6 @@ Check out the [source code here](/en-US/docs/Learn_web_development/Extensions/Fo
14631456

14641457
box-shadow: 0 0.1em 0.2em rgb(0 0 0 / 45%); /* 0 1px 2px */
14651458

1466-
background: #f0f0f0;
14671459
background: linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0);
14681460
}
14691461

@@ -1789,7 +1781,6 @@ Check out the [full source code here](/en-US/docs/Learn_web_development/Extensio
17891781

17901782
box-shadow: 0 0.1em 0.2em rgb(0 0 0 / 45%); /* 0 1px 2px */
17911783

1792-
background: #f0f0f0;
17931784
background: linear-gradient(0deg, #e3e3e3, #fcfcfc 50%, #f0f0f0);
17941785
}
17951786

files/en-us/learn_web_development/extensions/forms/html_forms_in_legacy_browsers/index.md

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ The {{HTMLElement("input")}} element can make things a little difficult if you w
7272
<input type="button" value="click me" />
7373
```
7474

75-
If we remove the border on all inputs, can we restore the default appearance on input buttons only?
75+
If we remove the border on all inputs, we can restore the default appearance for input buttons only with the global CSS {{cssxref('revert')}} value.
7676

7777
```css
7878
input {
@@ -81,22 +81,11 @@ input {
8181
border: 1px solid #ccc;
8282
}
8383
input[type="button"] {
84-
/* This does NOT restore the default rendering */
85-
border: none;
86-
}
87-
input[type="button"] {
88-
/* These don't either! Actually there is no standard way to do it in any browser */
89-
border: auto;
90-
border: initial;
91-
}
92-
input[type="button"] {
93-
/* This will come the closest to restoring default rendering. */
84+
/* Revert the last border declaration */
9485
border: revert;
9586
}
9687
```
9788

98-
See the global CSS {{cssxref('revert')}} value for more information.
99-
10089
### Let go of CSS
10190

10291
One of the big issues with HTML Forms is styling form widgets with CSS. Form controls appearance is browser and operating system specific. For example, the input of color type looks different in Safari, Chrome and Firefox browser, but the color picker widget is the same in all browsers on a device as it opens up the operating system's native color picker.

files/en-us/web/accessibility/aria/reference/roles/switch_role/index.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,10 @@ button.switch {
138138
border: 2px solid black;
139139
display: inline-block;
140140
margin-right: 0.25em;
141-
line-height: 20px;
142141
vertical-align: middle;
143142
text-align: center;
144143
font:
145-
12px "Open Sans",
144+
12px / 20px "Open Sans",
146145
"Arial",
147146
serif;
148147
}

files/en-us/web/api/animation/overallprogress/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ html {
5050
}
5151

5252
body {
53-
margin: 0;
5453
width: 500px;
5554
margin: 0 auto;
5655
padding: 20px;

files/en-us/web/api/web_audio_api/controlling_multiple_parameters_with_constantsourcenode/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ The HTML content for this example is primarily a checkbox, shaped as an actual b
6363
content: "";
6464
}
6565

66-
#playButton:not(checked) + label::after {
66+
#playButton:not(:checked) + label::after {
6767
content: "▶️";
6868
}
6969

files/en-us/web/api/webrtc_api/build_a_phone_with_peerjs/setup/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ p {
130130
}
131131

132132
button {
133-
background-color: -internal-light-dark(white, black);
133+
background-color: light-dark(white, black);
134134
padding: 1rem 10rem;
135135
border-radius: 3rem;
136136
border: none;

files/en-us/web/css/-webkit-text-stroke/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ The **`-webkit-text-stroke`** [CSS](/en-US/docs/Web/CSS) property specifies the
1212
```css
1313
/* Width and color values */
1414
-webkit-text-stroke: 4px navy;
15-
text-stroke: 4px navy;
1615

1716
/* Global values */
1817
-webkit-text-stroke: inherit;

files/en-us/web/css/@supports/index.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,16 @@ The `or` operator creates a new expression from the disjunction of two shorter e
200200
Multiple disjunctions can be juxtaposed without the need of more parentheses. The following are both equivalent:
201201

202202
```css
203-
@supports (transform-style: preserve) or (-moz-transform-style: preserve) or (-webkit-transform-style: preserve) {}
203+
@supports (transform-style: preserve) or (-moz-transform-style: preserve) or
204+
(-webkit-transform-style: preserve) {
205+
}
204206

205-
@supports (transform-style: preserve-3d) or ((-moz-transform-style: preserve-3d) or (-webkit-transform-style: preserve-3d))) {}
207+
@supports (transform-style: preserve-3d) or
208+
(
209+
(-moz-transform-style: preserve-3d) or
210+
(-webkit-transform-style: preserve-3d)
211+
) {
212+
}
206213
```
207214

208215
> [!NOTE]

files/en-us/web/css/_colon_open/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ select {
136136
font-size: 100%;
137137
padding: 5px;
138138
border: 1px solid black;
139-
background-color: white;
140139
background: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolygon points='5,5 15,5 10,15'/%3E%3C/svg%3E")
141140
no-repeat right 3px center / 1em 1em;
142141
}

files/en-us/web/css/_colon_read-only/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ textarea {
133133
display: block;
134134
font-family: inherit;
135135
font-size: 100%;
136-
padding: 0;
137136
margin: 0;
138137
box-sizing: border-box;
139138
padding: 5px;

files/en-us/web/css/css_colors/applying_color/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ The `.boxLeft` class, used to style the box on the left, sets up the color of th
169169
background-color: hwb(270deg 63% 13%);
170170
outline: 4px dashed #6e1478;
171171
color: hsl(0deg 100% 100%);
172-
text-decoration: underline;
172+
text-decoration-line: underline;
173173
text-decoration-style: wavy;
174174
text-decoration-color: #8f8;
175175
text-decoration: underline wavy #8f8;

files/en-us/web/css/css_conditional_rules/using_feature_queries/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ For example, the `selector()` function can be used to import a stylesheet for br
207207

208208
```css
209209
/* A `selector()` query within a `supports()` function */
210-
@import `/css/webkitShadowStyles.css`
210+
@import "/css/webkitShadowStyles.css"
211211
supports(selector(::-webkit-inner-spin-button));
212212
```
213213

files/en-us/web/css/css_containment/container_size_and_style_queries/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ The behavior of registered custom properties is different. When explicitly defin
200200
```css
201201
@property --theme-color {
202202
initial-value: rebeccapurple;
203-
inherited: true;
203+
inherits: true;
204204
}
205205

206206
:root {

files/en-us/web/css/css_fonts/variable_fonts_guide/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ In the following live example, you can adjust the slant.
402402
```css hidden live-sample___slant-example
403403
@font-face {
404404
font-family: "SlantFont";
405-
font-style: oblique -15 15;
405+
font-style: oblique -15deg 15deg;
406406
src: url("https://mdn.github.io/shared-assets/fonts/font_with_slant_axis.woff2")
407407
format("woff2");
408408
}

0 commit comments

Comments
 (0)